<template>
  <div>
    <el-form ref="form" :inline="true" :model="orderQuery" label-width="80px">
      <el-form-item label="请输入">
        <el-input
          v-model="orderQuery.carPlate"
          placeholder="车牌号 / 订单号 / 车主手机号"></el-input>
      </el-form-item>
      <el-form-item label="订单来源">
        <el-select v-model="orderQuery.paymentWay" placeholder="请选择订单来源">
          <el-option value="商务端"></el-option>
          <el-option value="天猫"></el-option>
          <el-option value="天猫平台"></el-option>
          <el-option value="淘宝"></el-option>
          <el-option value="微信小程序"></el-option>
          <el-option value="支付宝"></el-option>
          <el-option value="93应用"></el-option>
          <el-option value="中保车服"></el-option>
          <el-option value="大蜂保代"></el-option>
          <el-option value="路灵灵App"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="检测站">
        <el-autocomplete
          v-model="orderQuery.stationName"
          :fetch-suggestions="matchStation"
          placeholder="请输入检测站名称"
          @select="handleSelect"></el-autocomplete>
      </el-form-item>
      <el-form-item label="司机">
        <el-autocomplete
          v-model="orderQuery.driverName"
          :fetch-suggestions="matchDriver"
          placeholder="请输入司机姓名"
          @select="handleSelect2"></el-autocomplete>
      </el-form-item>
      <el-form-item>
        <pickArea :showArea="false" @getSite="setArea" />
      </el-form-item>
      <el-form-item label="订单状态">
        <el-select v-model="orderQuery.orderState"  @change="chooseOrder" placeholder="请选择订单状态">
          <el-option value="待开始"></el-option>
          <el-option value="正在进行"></el-option>
          <el-option value="订单完成"></el-option>
        </el-select>
      </el-form-item>
      <!-- 选择时间 -->
      <el-date-picker
        v-model="orderQuery.chooseTime"
        type="daterange"
        value-format="yyyy-MM-dd"
        start-placeholder="开始日期"
        end-placeholder="结束日期">
      </el-date-picker>
      <el-button type="primary" @click="handleCurrentChange(1)">查询</el-button>
    </el-form>
    <!-- 展开行 -->
    <el-table ref="topicTable" :data="orders" @expand-change="getShow" row-key="id" :expand-row-keys="expands">
      <el-table-column type="expand" >
             <el-steps  direction="vertical" :active="state" > 
                <el-step  title="预约">
                      <template  slot="description">
                       <el-form  label-position="left" inline >
                         <el-form-item label="车牌">
                           <span >{{stepShow.carPlate}}</span>
                         </el-form-item>
                       </el-form>
                       <el-form label-position="left" inline >
                         <el-form-item label="地址">
                           <span>{{stepShow.province}}{{stepShow.city}}{{stepShow.area}}{{stepShow.address}}</span>
                         </el-form-item>
                       </el-form>
                       <el-form label-position="left" inline >
                         <el-form-item label="预检时间">
                           <span>{{stepShow.placeTestTime}}</span>
                         </el-form-item>
                       </el-form>
                       <el-form label-position="left" inline >
                         <el-form-item label="订单号">
                           <span>{{stepShow.id}}</span>
                         </el-form-item>
                       </el-form>
                     </template>
                </el-step>
                <el-step title="预检">
                  <template slot="description">
                       <el-form label-position="left" inline >
                         <el-form-item label="客户姓名">
                           <span>{{stepShow.customerName}}</span>
                         </el-form-item>
                       </el-form>
                       <el-form label-position="left" inline >
                         <el-form-item label="客户电话">
                           <span>{{stepShow.customerPhone}}</span>
                         </el-form-item>
                       </el-form>
                       <el-form label-position="left" inline >
                         <el-form-item label="代检司机">
                           <span>{{stepShow.driverName}}</span>
                         </el-form-item>
                       </el-form>
                       <el-form label-position="left" inline >
                         <el-form-item label="实况照片">
                           <div v-if="stepShow.pickCarImg">
                              <el-image  v-for="(item,index) in  stepShow.pickCarImg" :key="index" :src="item" 
                               style="width:80px;height:80px;" :preview-src-list="stepShow.pickCarImg"></el-image>
                           </div>
                         </el-form-item>
                       </el-form>
                       <el-form label-position="left" inline >
                         <el-form-item label="取车签字">
                            <el-image v-if="stepShow.pickCarCustomerSign" :src="stepShow.pickCarCustomerSign" style="width:80px;height:80px;" :preview-src-list="[stepShow.pickCarCustomerSign]"></el-image>
                            <el-image v-if="stepShow.pickCarDriverSign" :src="stepShow.pickCarDriverSign" style="width:80px;height:80px;" :preview-src-list="[stepShow.pickCarDriverSign]"></el-image>
                         </el-form-item>
                       </el-form>
                     </template>
                </el-step>
                <el-step title="送检">
                   <template slot="description">
                       <el-form label-position="left" inline >
                         <el-form-item label="取车时间">
                           <span>{{stepShow.pickCarTime}}</span>
                         </el-form-item>
                       </el-form>
                       <el-form label-position="left" inline>
                         <el-form-item label="检测结果">
                           <span>{{stepShow.testResult}}</span>
                         </el-form-item>
                       </el-form>
                     </template>
                </el-step>
                <el-step title="还车">
                   <template slot="description">
                       <el-form label-position="left" inline >
                         <el-form-item label="还车时间">
                           <span>{{stepShow.backCarSuccessTime}}</span>
                         </el-form-item>
                       </el-form>
                       <el-form label-position="left" inline >
                         <el-form-item label="还车签字">
                           <el-image v-if="stepShow.backCarCustomerSign" :src="stepShow.backCarCustomerSign" style="width:80px;height:80px;" :preview-src-list="[stepShow.backCarCustomerSign]"></el-image>
                           <el-image v-if="stepShow.backCarDriverSign" :src="stepShow.backCarDriverSign" style="width:80px;height:80px;" :preview-src-list="[stepShow.backCarDriverSign]"></el-image>
                         </el-form-item>
                       </el-form>
                     </template>
                </el-step>
                <el-step title="归档">
                   <template slot="description">
                       <el-form label-position="left" inline >
                         <el-form-item label="评价反馈">
                            <el-image v-if="stepShow.receiptImg" :src="stepShow.receiptImg"
                             style="width:80px;height:80px;" :preview-src-list="[stepShow.receiptImg]"></el-image>
                         </el-form-item>
                       </el-form>
                       <el-form label-position="left" inline >
                         <el-form-item label="回执图">
                           <div v-if="stepShow.testReport">
                              <el-image  v-for="(item,index) in  stepShow.testReport" :key="index" :src="item" 
                              style="width:80px;height:80px;" :preview-src-list="stepShow.testReport"></el-image>
                           </div>
                         </el-form-item>
                       </el-form>
                     </template>
                </el-step>
            </el-steps>
    </el-table-column>
    <!-- 表头 -->
      <el-table-column prop="carPlate" label="车牌">
        <template v-slot="scope">
          <el-tag size="small">{{ scope.row.carPlate }}</el-tag>
        </template>
      </el-table-column>
      <el-table-column prop="customerName" label="车主姓名"></el-table-column>
      <el-table-column prop="customerPhone" label="车主电话"></el-table-column>
      <el-table-column prop="address" label="提车地址">
        <template v-slot="scope">
          {{
            scope.row.province +
            scope.row.city +
            scope.row.area +
            scope.row.address
          }}
        </template>
      </el-table-column>
      <el-table-column prop="placeTestTime" label="预检时间"></el-table-column>
      <el-table-column prop="carType" label="车型"></el-table-column>
      <el-table-column prop="placeOrderTime" label="下单时间"></el-table-column>
      <el-table-column prop="contactTime" label="联系时间"></el-table-column>
      <el-table-column prop="orderMoney" label="用户检测费"></el-table-column>
      <el-table-column prop="orderServiceFee" label="服务费">
        <template v-slot="scope">
          <div>{{scope.row.paymentWay=='中保车服'? scope.row.orderServiceFee:'/'}}</div>
        </template> 
      </el-table-column>
      <el-table-column prop="payStationFee" label="检测站费"></el-table-column>
      <el-table-column prop="payDriverFee" label="司机服务费"></el-table-column>
      <el-table-column prop="paymentWay" label="订单来源"></el-table-column>
      <el-table-column prop="stationName" label="检测站"></el-table-column>
      <el-table-column prop="driverName" label="代检司机"></el-table-column>
      <el-table-column prop="" label="接单状态">
       <template v-slot="scope">
          <el-tag
            type="danger"
            v-if="scope.row.receiveOrder == '超时接单'"
            effect="dark">超时接单</el-tag>
          <el-tag
            type="success"
            v-else-if="scope.row.receiveOrder == '正常接单'"
            effect="dark">正常接单</el-tag>
       </template>
      </el-table-column>

      <el-table-column prop="orderState" label="订单状态">
        <template v-slot="scope">
          <el-tag
            type="danger"
            v-if="scope.row.orderState == '待开始'"
            effect="dark">待开始</el-tag>
          <el-tag
            type="warning"
            v-else-if="scope.row.orderState == '正在进行'"
            effect="dark">正在进行</el-tag>
          <el-tag
            type="success"
            v-else-if="scope.row.orderState == '订单完成'"
            effect="dark">订单完成</el-tag>
        </template>
      </el-table-column>

      <el-table-column prop label="操作" fixed="right" width="220">
        <template v-slot="scope">
          <el-button size="mini" type="primary" @click="getDetail(scope.row)">修改</el-button>
          <el-button
            size="mini"
            type="info"
            style="margin-left: 0"
            v-if="scope.row.orderState == '订单完成'"
            @click="showOrder(scope.row)">结算</el-button>
          <el-button
            size="mini"
            type="danger"
            @click="deleteDriverOrder(scope.row.id)">刪除</el-button >
        </template>
      </el-table-column>
    </el-table>
    <!-- ------------------修改按钮的修改功能开始----------------------- -->
    <el-dialog title="订单详情" :visible.sync="centerDialogVisible" center>
      <el-descriptions :border="true">
        <el-descriptions-item label="订单id">{{newObj.id}}</el-descriptions-item>
        <el-descriptions-item label="车牌">
          <el-input v-model="newObj.carPlate"></el-input>
        </el-descriptions-item>
        <el-descriptions-item label="车型">{{newObj.carType}}</el-descriptions-item>
        <el-descriptions-item label="客户姓名">
          <el-input v-model="newObj.customerName"></el-input>
        </el-descriptions-item>
        <el-descriptions-item label="客户电话">
          <el-input v-model="newObj.customerPhone" maxlength="11"> </el-input></el-descriptions-item>
        <el-descriptions-item label="下单时间">{{newObj.placeOrderTime}}</el-descriptions-item>
        <el-descriptions-item label="用户检测费" >
          <el-input v-model="newObj.orderMoney" :disabled="newObj.paymentWay!=='中保车服'"></el-input>
        </el-descriptions-item>
        <el-descriptions-item label="服务费" >
          <el-input v-model="newObj.orderServiceFee" v-if="newObj.paymentWay=='中保车服'"></el-input>
        </el-descriptions-item>
        <el-descriptions-item label="司机服务费">
          <el-input v-model="newObj.payDriverFee"></el-input>
        </el-descriptions-item>
        <el-descriptions-item label="检测站费">
          <el-input v-model="newObj.payStationFee"></el-input>
        </el-descriptions-item>
        <el-descriptions-item label="订单状态">
          <el-select v-model="newObj.orderState" placeholder="请选择订单状态">
            <el-option value="待开始"></el-option>
            <el-option value="正在进行"></el-option>
            <el-option value="订单完成"></el-option>
          </el-select>
        </el-descriptions-item>
        <el-descriptions-item label="检测站">
          <el-select
            v-model="newObj.stationName"
            placeholder="请选择"
            @change="changeStation">
            <el-option
              v-for="item in stations"
              :key="item.id"
              :label="item.name + ' ('+item.distance+'km)'"
              :value="item">
            </el-option>
          </el-select>
        </el-descriptions-item>
        <el-descriptions-item label="代检司机">
          <el-select
            v-model="newObj.driverName"
            placeholder="请选择"
            @change="changeDriver">
            <el-option
              v-for="item in drivers"
              :key="item.id"
              :label="item.driverName"
              :value="item">
            </el-option>
          </el-select>
        </el-descriptions-item>
        <el-descriptions-item label="支付方式">{{newObj.paymentWay}}</el-descriptions-item>
        <el-descriptions-item label="支付状态">
          <el-select v-model="newObj.paymentState" :disabled="newObj.paymentWay!=='中保车服'" placeholder="请选择支付状态">
            <el-option value="未支付"></el-option>
            <el-option value="已支付"></el-option>
          </el-select>
        </el-descriptions-item>
        <el-descriptions-item label="预检时间">
          <el-date-picker
            type="datetime"
            placeholder="选择日期"
            v-model="newObj.placeTestTime"></el-date-picker>
        </el-descriptions-item>
        <el-descriptions-item label="提车地址">{{newObj.province + newObj.city + newObj.area + newObj.address}}</el-descriptions-item>
        <el-descriptions-item label="行驶证">
          <el-image
            v-for="(item, index) in newObj.merchantLicenseImg"
            :key="index"
            :src="item"
            style="width: 100px"
            fit="scale-down"
            lazy
            :preview-src-list="newObj.merchantLicenseImg"></el-image>
          <el-upload
            class="avatar-uploader"
            :action="this.$http.defaults.baseURL + '/file/uploadFile'"
            :show-file-list="false"
            :on-success="updateLicenseImgs">
            <img v-if="imageUrl" :src="imageUrl" class="avatar" />
            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
          </el-upload>
        </el-descriptions-item>
         <el-descriptions-item label="客服">{{newObj.staff}}</el-descriptions-item>
         <el-descriptions-item label="备注">{{newObj.remarks}}</el-descriptions-item>
      </el-descriptions>
      <el-button class="update-order" type="primary" @click="updateOrder">提 交</el-button>
    </el-dialog>
    <!-- ------------------修改按钮的修改功能结束----------------------- -->

    <!-- ------------------生成订单按钮的功能----------------------- -->
    <el-dialog title="生成结算单" :visible.sync="dialogFormVisible">
      <el-form :model="form">
        <el-form-item label="" label-width="120px">
          <el-select
            v-model="form.region"
            placeholder="请选择"
            @change="choose">
            <el-option label="检测站" value="checkstation">检测站</el-option>
            <!-- <el-option  label="个人" value="person">个人</el-option> -->
            <!-- <el-option  label="公司" value="company">公司 </el-option> -->
          </el-select>
        </el-form-item>
      </el-form>
      <el-descriptions
        v-if="seen == 'checkstation'"
        direction="vertical "
        :column="1"
        border>
        <el-descriptions-item label="款项用途">
          检测站订单结算(已收款: {{ newObj2.orderMoney }} 元 )
        </el-descriptions-item>
        <el-descriptions-item label="收款单位">{{ billingInfo.name}}</el-descriptions-item>
        <el-descriptions-item label="收款单位开户行"> {{ billingInfo.bankName }}</el-descriptions-item>
        <el-descriptions-item label="收款单位账号"> {{ billingInfo.bankAccount }}</el-descriptions-item>
        <el-descriptions-item label="金额及支付方式"> {{ billingInfo.safePrice + billingInfo.envPrice }} </el-descriptions-item>
        <el-descriptions-item label="发票类型"> 増专 </el-descriptions-item>
        <el-descriptions-item label="申请人"></el-descriptions-item>
        <el-descriptions-item label="审批人"></el-descriptions-item>
        <el-descriptions-item label="日期">{{ today }}</el-descriptions-item>
      </el-descriptions>
      <!-- <el-descriptions  title="" v-else-if="seen == 'person'" direction="vertical " :column="1" border>
            <el-descriptions-item label="款项用途">检测站上门服务费：100元</el-descriptions-item>
            <el-descriptions-item label="收款单位">黄德</el-descriptions-item>
            <el-descriptions-item label="收款单位开户行" >中国农业银行上海市北翟路凌空支行</el-descriptions-item>
            <el-descriptions-item label="收款单位账号"> 6228450038018620571</el-descriptions-item>
            <el-descriptions-item label="金额及支付方式">100元</el-descriptions-item>
            <el-descriptions-item label="发票类型">増专</el-descriptions-item>
            <el-descriptions-item label="申请人"></el-descriptions-item>
            <el-descriptions-item label="审批人"></el-descriptions-item>
            <el-descriptions-item label="日期">{{ today }}</el-descriptions-item>
        </el-descriptions>
        <el-descriptions  title=""  v-else-if="seen == 'company'"  direction="vertical " :column="1" border>
          <el-descriptions-item label="款项用途">检测站上门服务费：120元</el-descriptions-item>
          <el-descriptions-item label="收款单位">挚晟（北京）信息科技有限公司</el-descriptions-item>
          <el-descriptions-item label="收款单位开户行" >平安银行北京海淀支行</el-descriptions-item>
          <el-descriptions-item label="收款单位账号"> 15767618430008</el-descriptions-item>
          <el-descriptions-item label="金额及支付方式">120元</el-descriptions-item>
          <el-descriptions-item label="发票类型">増专</el-descriptions-item>
          <el-descriptions-item label="申请人"></el-descriptions-item>
          <el-descriptions-item label="审批人"></el-descriptions-item>
          <el-descriptions-item label="日期">{{ today }}</el-descriptions-item>
        </el-descriptions> -->

      <el-button class="downorder" type="primary" @click="down(billingInfo)">下 载</el-button>
    </el-dialog>
    <!-- ------------------生成订单按钮的功能结束----------------------- -->

    <!-- 分页 -->
    <el-pagination
      background
      layout="prev, sizes,pager, next, jumper"
      :total="total"
      @current-change="handleCurrentChange"
      @size-change="handleSizeChange"
      :page-sizes="[5, 10, 15, 20]"
      :page-size="50"></el-pagination>
  </div>
</template>
<script>
import axios from "axios";
import { Checkbox } from "element-ui";
import pickArea from '@/components/pickArea.vue';
export default {
  inject: ["reload"],
  components: {
    pickArea,
  },
  data: function () {
    return {
      seen: "",
      today: "",
      orders: [],
      state:0,
      chooseTime: '',
      expands: [],
      total: 0,
      newObj: {},
      stepShow: {},
      billingInfo: {},
      centerDialogVisible: false,
      orderQuery: {
        pageNum: 1,
        pageSize: 10,
      },
      stations: [],
      newObj2: "",
      drivers: [],
      imageUrl: "",
      dialogFormVisible: false,
      form: {
        region: "checkstation",
      },
    };
  },    
  created: function () {
    this.handleCurrentChange(1);
  },
  methods: {
    handleCurrentChange: async function (val = 1) {
      this.orderQuery.pageNum = val;
      const { data } = await this.$http.post(
        `/order/getDriverOrder`,this.orderQuery);
      if (data.code == 1) {
        data.object.list.forEach((order) => {
          if (order.merchantLicenseImg)
            order.merchantLicenseImg = JSON.parse(order.merchantLicenseImg);
        }); 
        this.orders = data.object.list;
        this.total = data.object.total;
        this.orders.forEach(item =>{
        var starttime_ms = Date.parse(new Date(item.placeOrderTime.replace(/-/g, "/")))
        var endTime_ms = item.contactTime  == null ? new Date().getTime() : Date.parse(new Date(item.contactTime.replace(/-/g, "/"))); 
        var lastTime = endTime_ms - starttime_ms
        if(lastTime>1800000){
          item.receiveOrder="超时接单";
        }else{
          item.receiveOrder="正常接单";
        }
        })
      } else {
        this.$message({
          message: data.message,
          type: "error",
        });
      }
    },
    chooseOrder:async function(){
      this.orderState= this.orderQuery
      const {data} = await this.$http.post(`/order/getDriverOrder`,this.orderState);
      this.handleCurrentChange(1);
    },
    getShow:async function(row, expandedRows){
      if (expandedRows.length) { 
        this.expands = [row.id]
        this.show = row 
        const {data} = await this.$http.get(`/order/getOrderDetail?id=${this.show.id}`);
        this.stepShow = data.object
        this.stepShow.testReport=(this.stepShow.testReport!==null&&this.stepShow.testReport.length>0)?JSON.parse(this.stepShow.testReport):[]
        this.stepShow.pickCarImg=(this.stepShow.pickCarImg.includes('http')&&this.stepShow.pickCarImg.length>0)?JSON.parse(this.stepShow.pickCarImg):[]

      switch(this.stepShow.serviceState){
        case '预约':
          this.state=1
        break;
        case '预检':
          this.state=2
        break;
        case '送检':
          this.state=3
        break;
        case '还车':
          this.state=4
        break;
        case '归档':
          this.state=5
        break;
        default:
          this.state=0
      }
      this.orders=this.orders.slice(0)
      } else { 
        this.expands = []
      }
    },
    handleSizeChange(val) {
      this.orderQuery.pageSize = val;
      this.handleCurrentChange(1);
    },
    async choose(e) {
      const { data: stations } = await this.$http.get(
        `/testStation/getStationById?stationId=${this.newObj2.stationId}`
      );
      this.billingInfo = stations.object;
      var Today = new Date();
      this.today =
        Today.getFullYear() +
        "年" +
        (Today.getMonth() + 1) +
        "月" +
        Today.getDate() +
        "日";
      this.seen = e;
    },
    // 修改
    getDetail: async function (obj) {
      this.newObj = obj;
      const { data: stations } = await this.$http.get(
        `/testStation/getAllStation?province=${obj.province}&city=${obj.city}&area=${obj.area}&address=${obj.address}&pageSize=50&coordinate=${encodeURIComponent(obj.coordinate)}`
      );
      this.stations = stations.object.list;
      const { data: drivers } = await this.$http.get(
        `/driverUser/getAllDriver?province=${obj.province}&city=${obj.city}&pageSize=50`
      );
      this.drivers = drivers.object.list;
      this.centerDialogVisible = true;
    },
    showOrder: async function (obj) {
      this.seen = "checkstation";
      this.newObj2 = obj;
      const { data: stations } = await this.$http.get(
        `/testStation/getStationById?stationId=${this.newObj2.stationId}`
      );
      this.billingInfo = stations.object;
      var Today = new Date();
      this.today =
        Today.getFullYear() +
        "年" +
        (Today.getMonth() + 1) +
        "月" +
        Today.getDate() +
        "日";
      this.dialogFormVisible = true;
    },
    down: async function (obj) {
      axios({
        method: "post",
        url: `${this.$http.defaults.baseURL}/order/generatePayment`,
        headers: {
          "Content-Type": "application/json",
        },
        data: {
          price: this.newObj2.orderMoney,
          name: this.billingInfo.name,
          bankName: this.billingInfo.bankName,
          bankAccount: this.billingInfo.bankAccount,
          settlementPrice: this.billingInfo.safePrice + this.billingInfo.envPrice,
          today: this.today,
        },
        responseType: "arraybuffer",
      }).then((res) => {
        let headers = res.headers;
        let blob = new Blob([res.data], {
          type: headers["content-type"],
        });
        let link = document.createElement("a");
        link.href = window.URL.createObjectURL(blob);
        link.download = "检测站订单结算申请单.docx";
        link.click();
      });
    },
    // 查询检测站
    matchStation: async function (stationName, cb) {
      const { data } = await this.$http.get(
        `/testStation/getAllStation?stationName=${
          stationName ? stationName : ""
        }`
      );
      if (data.code == 1) {
        let stations = [];
        data.object.list.forEach((station) => {
          stations.push({
            id: station.id,
            value: station.name,
          });
        });
        cb(stations);
      } else {
        this.$message({
          message: data.message,
          type: "error",
        });
      }
    },
    // 查询司机
    matchDriver: async function (driverName, cb) {
      const { data } = await this.$http.get(
        `/driverUser/getAllDriver?driverName=${
          driverName ? driverName : ""
        }`
      );
      if (data.code == 1) {
        let drivers = [];
       data.object.list.forEach((driver) => {
          drivers.push({
            id: driver.id,
            value: driver.driverName,
          });
        });
        cb(drivers);
      } else {
        this.$message({
          message: data.message,
          type: "error",
        });
      }
    },
    handleSelect(item) {
      this.orderQuery.stationId = item.id;
      this.handleCurrentChange(1);
    },
    handleSelect2(item) {
      this.orderQuery.driverId = item.id;
      this.handleCurrentChange(1);
    },
    changeStation: function (option) {
      this.newObj.stationName = option.name;
      this.newObj.stationId = option.id;
    },
    changeDriver: function (option) {
      this.newObj.driverName = option.driverName;
      this.newObj.driverId = option.id;
    },
    updateLicenseImgs: function (res, file, fileList) {
      this.newObj.merchantLicenseImg.push(res.object.url);
    },
    //提交修改
    updateOrder: async function () {
      this.newObj.placeTestTime = new Date(this.newObj.placeTestTime);
      const { data } = await this.$http.post(
        `/order/updateDriverOrder`,
        this.newObj
      );
      if (data.code == 1) {
        this.$message.success("修改成功");
      } else {
        this.$message({
          message: data.message,
          type: "error",
        });
      }
      this.reload();
    },
    deleteDriverOrder:async function (id) {
      this.$confirm("确认删除该订单吗?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(async () => {
          const { data } = await this.$http.delete(
            `/order/deleteDriverOrder?id=${id}`
          );
          if (data.code == 1) {
            this.$message.success("删除成功");
            this.reload();
          } else {
            this.$message({
              message: data.message,
              type: "error",
            });
          }
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    setArea: function (province, city,) {
      this.orderQuery.province = province
      this.orderQuery.city = city
      this.handleCurrentChange()
    },

   

  },
};
</script>
<style>
.update-order {
  position: relative;
  left: 50%;
  transform: translate(-50%, 50%);
}
/* .cell{
  position: relative;
  z-index: 1;
}
.el-table__expand-icon{
  position: relative;
  z-index: -1;
} */
</style>